<?php

if ($this->search_results)
{
    print "<ul data-role=\"listview\">\n";
    foreach ($this->search_results as $r)
    {
        $url = $this->url (array('controller' => 'recipe', 'action' => 'view', 'id_recipe' => $r->get_id ()), null, true );
        $title = $r->get_title ();

        print <<<__TEXT__
<li><a href="$url">$title</a></li>

__TEXT__;

    }
    print "</ul>\n";
    return;
}

if ($this->form)
{
    print $this->form;
    return;
}

$url1 = $this->url (array('controller' => 'recipe', 'action' => 'search',
    'search_by' => 'title'), null, true );
$url2 = $this->url (array('controller' => 'recipe', 'action' => 'search',
    'search_by' => 'tags'), null, true );
$url3 = $this->url (array('controller' => 'recipe', 'action' => 'search',
    'search_by' => 'ingredients'), null, true );
$url4 = $this->url (array('controller' => 'recipe', 'action' => 'search',
    'search_by' => 'source'), null, true );
$url5 = $this->url (array('controller' => 'recipe', 'action' => 'search',
    'search_by' => 'title,tags,ingredients,directions,source'), null, true );

    print <<<__TEXT__
<ul data-role="listview">
<li><a href="$url1">Search by title</a></li>
<li><a href="$url2">Search by tag</a></li>
<li><a href="$url3">Search by ingredients</a></li>
<li><a href="$url4">Search by source</a></li>
<li><a href="$url5">Search by any</a></li>
</ul>
__TEXT__;

